package action;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import entitybean.l_sequence.EntityBeanL_Sequence;
import entitybean.oc_company_info.EntityBeanOc_Company_Info;
import entitybean.oc_friendly_link.EntityBeanOc_Friend_Link;
import entitybean.oc_news.EntityBeanOc_News;
import entitybean.oc_user_name.EntityBeanOc_User_Name;
import entitybean.system_log.EntitybeanSystem_Log;
import entitybean.systemtree.EntityBeanSystemtree;
import form.CompanyInfoForm;
import form.Insert_NewsForm;
import form.NewsLinkForm;
import form.NewsListForm;
import service.service_admin.Service_Admin;
import service.service_public.Service_Public;
import tools.Convert;
import tools.HttpTools;
import tools.InterfaceCompanyInfoList;
import tools.InterfaceForResultSetToList;
import tools.InterfaceNewLinkList;
import tools.PageBeanPlus;
import tools.Pager;
import tools.Result;
import view.ViewOc_News;

public class Action_Admin extends DispatchAction {
	private Service_Admin service_admin;
	private Service_Public service_public;

	public Service_Admin getService_admin() {
		return service_admin;
	}

	public void setService_admin(Service_Admin service_admin) {
		this.service_admin = service_admin;
	}

	public Service_Public getService_public() {
		return service_public;
	}

	public void setService_public(Service_Public service_public) {
		this.service_public = service_public;
	}

	public ActionForward edit_username(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		EntityBeanOc_User_Name Ocean_User = (EntityBeanOc_User_Name) request
				.getSession().getAttribute("Ocean_User");
		String Ocean_Login = (String) request.getSession().getAttribute(
				"Ocean_Login");
		System.out.println("Ocean_User=" + Ocean_User);
		System.out.println("Ocean_Login=" + Ocean_Login);
		// �ж��Ƿ�Ϊ�Ϸ���Ա

		System.out.println("�����û���Ϣ....");
		String username_id = request.getParameter("username_id");
		EntityBeanOc_User_Name e = this.service_admin
				.Find_EntityBeanOc_User_Name_By_ID(Integer.valueOf(username_id));
		request.setAttribute("edit_username", e);
		return mapping.findForward("success");
	}

	public ActionForward init_add_admin_form(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println("��ʼ�� �����ݿ����Ա ��Ϣ");
		List<EntityBeanSystemtree> list = this.service_admin
				.Find_SystemTree_By_c_jd(0);
		request.setAttribute("EntityBeanSystemtreeList", list);

		return mapping.findForward("success");
	}

	public ActionForward insert_admin(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		System.out.println("¼�� ����Ա�˺� ��Ϣ");
		DynaActionForm loginform = (DynaActionForm) form;
		String username = loginform.getString("username");
		System.out.println("username=" + username);
		String password = loginform.getString("password");
		System.out.println("password=" + password);
		String re_password = loginform.getString("re_password");
		System.out.println("re_password=" + re_password);
		String realname = loginform.getString("realname");
		System.out.println("realname=" + realname);
		String backup = loginform.getString("backup");
		System.out.println("backup=" + backup);
		String power = loginform.getString("power");
		System.out.println("power=" + power);
		String email = loginform.getString("email");
		System.out.println("email=" + email);
		EntityBeanL_Sequence l = new EntityBeanL_Sequence();
		EntityBeanL_Sequence l1 = new EntityBeanL_Sequence();
		HttpTools httptools = new HttpTools();
		Integer id = 0;
		String ip = httptools.getIpAddr(request);
		l = this.service_public.Find_L_Sequence_By_seq_Name("SEQ_OC_USERNAME");
		l1 = this.service_public.Find_L_Sequence_By_seq_Name("SEQ_SYSTEM_LOG");

		id = l.getSeq_Value() + 1;
		l.setSeq_Value(id);

		Date d = new Date();
		EntityBeanOc_User_Name e = new EntityBeanOc_User_Name();
		e.setId(id);
		e.setBackup(backup);
		e.setPassword(password);
		e.setDel("OFF");
		e.setIsactive("ACT");
		e.setLast_action(d);
		e.setLogin_time(d);
		e.setPower(power);
		e.setRealname(realname);
		e.setUsername(username);
		e.setEmail(email);

		EntityBeanOc_User_Name Ocean_User = new EntityBeanOc_User_Name();
		Ocean_User = (EntityBeanOc_User_Name) request.getSession()
				.getAttribute("Ocean_User");
		if (Ocean_User == null) {
			System.out.println("�Ự������ʧ���������");
			return mapping.findForward("error");
		}

		EntitybeanSystem_Log log = new EntitybeanSystem_Log();
		id = l1.getSeq_Value() + 1;
		l1.setSeq_Value(id);
		log.setAction("�û�������µĹ���Ա���û���=" + e.getUsername() + " ����="
				+ e.getPassword());
		log.setId(id);
		log.setIp(ip);
		log.setLog_kind("写入");
		log.setUpdate_time(d);
		log.setUser_id(Ocean_User.getId());

		request.setAttribute("error_msg", "������µĹ���Ա��Ϣ~");

		this.service_public.Update_L_Sequence(l1);
		this.service_public.Insert_System_Log(log);
		this.service_admin.Insert_Oc_User_Name(e);
		this.service_public.Update_L_Sequence(l);

		List<EntityBeanSystemtree> list = this.service_admin
				.Find_SystemTree_By_c_jd(0);
		request.setAttribute("EntityBeanSystemtreeList", list);
		return mapping.findForward("success");
	}

	public ActionForward init_oc_station(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println("��ʼ��ʼ��վ��¼��ҳ��");

		System.out.println("���庽��������");

		System.out.println("������������������");

		return mapping.findForward("success");
	}

	public ActionForward insert_oc_station(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println("��վ������һ���µ�վ��");
		DynaActionForm loginform = (DynaActionForm) form;
		String oc_voyage_id = loginform.getString("oc_voyage_id");
		String station_name = loginform.getString("station_name");
		String longitude_A = loginform.getString("longitude_A");
		String longitude_B = loginform.getString("longitude_B");
		String dimensionality_A = loginform.getString("dimensionality_A");
		String dimensionality_B = loginform.getString("dimensionality_B");
		String territorial_waters = loginform.getString("territorial_waters");
		String depth = loginform.getString("depth");
		String work_time = loginform.getString("work_time");
		String ctd = loginform.getString("ctd");
		System.out.println("��ȡ�?��Ϣ....");
		System.out.println("oc_voyage_id=" + oc_voyage_id);
		System.out.println("station_name=" + station_name);
		System.out.println("longitude_A=" + longitude_A);
		System.out.println("longitude_B=" + longitude_B);
		System.out.println("dimensionality_A=" + dimensionality_A);
		System.out.println("dimensionality_B=" + dimensionality_B);
		System.out.println("territorial_waters=" + territorial_waters);
		System.out.println("depth=" + depth);
		System.out.println("work_time=" + work_time);
		System.out.println("ctd=" + ctd);
		System.out.println("��ݻ�ȡ���....");

		System.out.println("��������ִ��д�����....");

		System.out.println("��������ִ��д�������־....");

		return mapping.findForward("success");
	}

	public ActionForward admin_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println("��ʼ������ģ��");
		// ��װ���Ų�ѯ����ݼ��?
		NewsLinkForm newslistform = (NewsLinkForm) form;
		newslistform.setCurrentpage("1");
		newslistform.setFriend_link_name("");
		newslistform.setOver_time("");
		newslistform.setStart_time("");
		String sql = "select friend_link_name,id,friend_link_url,sort from OC_FRIEND_LINK where del='OFF' ORDER BY sort DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceNewLinkList interfaceforresultsettolist = new InterfaceNewLinkList();
		List<EntityBeanOc_Friend_Link> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		System.out.println("list.size()" + list.size());
		return mapping.findForward("success");
	}

	public ActionForward admin_search_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		NewsLinkForm newslistform = (NewsLinkForm) form;
		String sql = "select friend_link_name,id,friend_link_url,sort from OC_FRIEND_LINK where del='OFF' ORDER BY sort DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceNewLinkList interfaceforresultsettolist = new InterfaceNewLinkList();
		List<EntityBeanOc_Friend_Link> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		System.out.println("list.size()" + list.size());
		return mapping.findForward("success");
	}

	public ActionForward admin_company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm newslistform = (CompanyInfoForm) form;
		String sql = "select company_name,address,tel,email,id from OC_COMPANY_INFO where del='OFF' ORDER BY id DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceCompanyInfoList interfaceforresultsettolist = new InterfaceCompanyInfoList();
		List<EntityBeanOc_Company_Info> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());
		request.setAttribute("pagebeanplus", pagebeanplus);
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}

	public ActionForward admin_img_upload(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return mapping.findForward("success");
	}

	public ActionForward admin_insert_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		NewsLinkForm loginform = (NewsLinkForm) form;
		String friend_link_name = loginform.getFriend_link_name();
		String friend_link_url = loginform.getFriend_link_url();
		String sort = loginform.getSort();
		EntityBeanOc_Friend_Link link = new EntityBeanOc_Friend_Link();
		link.setFriend_link_name(friend_link_name);
		link.setFriend_link_url(friend_link_url);
		link.setSort(sort);
		link.setDel("OFF");
		Integer i = 0;
		EntityBeanL_Sequence entity = new EntityBeanL_Sequence();
		entity = this.service_public
				.Find_L_Sequence_By_seq_Name("SEQ_OC_FriendLink");
		i = entity.getSeq_Value() + 1;
		entity.setSeq_Value(i);
		link.setId(i);
		this.service_public.Update_L_Sequence(entity);
		this.service_admin.Insert_Oc_Friend_Link(link);
		System.out.println("��ʼ������ģ��");
		// ��װ���Ų�ѯ����ݼ��?
		NewsLinkForm newslistform = (NewsLinkForm) form;
		newslistform.setCurrentpage("1");
		newslistform.setFriend_link_name("");
		newslistform.setOver_time("");
		newslistform.setStart_time("");
		String sql = "select friend_link_name,id,friend_link_url,sort from OC_FRIEND_LINK where del='OFF' ORDER BY sort DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceNewLinkList interfaceforresultsettolist = new InterfaceNewLinkList();
		List<EntityBeanOc_Friend_Link> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}

	public ActionForward admin_update_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		NewsLinkForm loginform = (NewsLinkForm) form;
		String friend_link_name = loginform.getFriend_link_name();
		String friend_link_url = loginform.getFriend_link_url();
		String sort = loginform.getSort();
		String id = loginform.getId();
		EntityBeanOc_Friend_Link link = new EntityBeanOc_Friend_Link();
		link.setFriend_link_name(friend_link_name);
		link.setFriend_link_url(friend_link_url);
		link.setDel("OFF");
		link.setSort(sort);
		link.setId(Integer.valueOf(id));
		this.service_admin.Update_Oc_Friend_Link(link);
		NewsLinkForm newslistform = (NewsLinkForm) form;
		newslistform.setCurrentpage("1");
		newslistform.setFriend_link_name("");
		newslistform.setFriend_link_url("");
		newslistform.setOver_time("");
		newslistform.setStart_time("");
		String sql = "select friend_link_name,id,friend_link_url,sort from OC_FRIEND_LINK where del='OFF' ORDER BY sort DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceNewLinkList interfaceforresultsettolist = new InterfaceNewLinkList();
		List<EntityBeanOc_Friend_Link> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}

	public ActionForward init_insert_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		return mapping.findForward("success");
	}

	public ActionForward init_update_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		DynaActionForm loginform = (DynaActionForm) form;
		String id = loginform.getString("id");
		EntityBeanOc_Friend_Link link = this.service_admin
				.Find_EntityBeanOc_Friend_Link_By_ID(Integer.valueOf(id));
		request.setAttribute("PlaceView", link);
		return mapping.findForward("success");
	}

	public ActionForward admin_delete_friend_link(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		NewsLinkForm f = (NewsLinkForm) form;
		String id = f.getId();
		System.out.println("id=" + id);
		id = this.cut_tail(id);
		this.service_admin.Delete_Oc_Friend_Link(id);

		String sql = "select friend_link_name,id,friend_link_url,sort from OC_FRIEND_LINK where del='OFF' ORDER BY sort DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(f.getRowcountperpage()), Integer.valueOf(f
						.getCurrentpage()), "loadrichtext()");
		InterfaceNewLinkList interfaceforresultsettolist = new InterfaceNewLinkList();
		List<EntityBeanOc_Friend_Link> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", f);
		System.out.println("list.size()" + list.size());
		return mapping.findForward("success");
	}

	public ActionForward admin_search_study(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		NewsListForm newslistform = (NewsListForm) form;
		System.out.println("newslistform.getCurrentpage()="
				+ newslistform.getCurrentpage());
		System.out.println("newslistform.getNews_title()="
				+ newslistform.getNews_title());
		System.out.println("newslistform.getOver_time()="
				+ newslistform.getOver_time());
		System.out.println("newslistform.getStart_time()="
				+ newslistform.getStart_time());
		String sql = "select NEWS_TITLE,UPDATE_TIME,USER_ID,ID from OC_STUDY where del='OFF' ORDER BY UPDATE_TIME DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceForResultSetToList interfaceforresultsettolist = new InterfaceForResultSetToList();
		List<ViewOc_News> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		System.out.println("list.size()" + list.size());
		return mapping.findForward("success");
	}

	public ActionForward admin_init_study(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		NewsListForm newslistform = (NewsListForm) form;
		System.out.println("newslistform.getCurrentpage()="
				+ newslistform.getCurrentpage());
		System.out.println("newslistform.getNews_title()="
				+ newslistform.getNews_title());
		System.out.println("newslistform.getOver_time()="
				+ newslistform.getOver_time());
		System.out.println("newslistform.getStart_time()="
				+ newslistform.getStart_time());
		String sql = "select NEWS_TITLE,UPDATE_TIME,USER_ID,ID from OC_STUDY where del='OFF' ORDER BY UPDATE_TIME DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceForResultSetToList interfaceforresultsettolist = new InterfaceForResultSetToList();
		List<ViewOc_News> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());

		request.setAttribute("pagebeanplus", pagebeanplus);// ���ô��ݵ�ҳ������
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		System.out.println("list.size()" + list.size());
		return mapping.findForward("success");

	}

	public ActionForward init_admin__company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return mapping.findForward("success");
	}

	public ActionForward admin_insert__company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm loginform = (CompanyInfoForm) form;
		String company_name = loginform.getCompany_name();
		String address = loginform.getAddress();
		String email = loginform.getEmail();
		String tel = loginform.getTel();
		EntityBeanOc_Company_Info company = new EntityBeanOc_Company_Info();
		company.setCompany_name(company_name);
		company.setAddress(address);
		company.setEmail(email);
		company.setTel(tel);
		company.setDel("OFF");
		Integer i = 0;
		EntityBeanL_Sequence entity = new EntityBeanL_Sequence();
		entity = this.service_public
				.Find_L_Sequence_By_seq_Name("SEQ_OC_CompanyInfo");
		i = entity.getSeq_Value() + 1;
		entity.setSeq_Value(i);
		company.setId(i);
		this.service_public.Update_L_Sequence(entity);
		this.service_admin.Insert_Oc_Company_Info(company);
		CompanyInfoForm newslistform = (CompanyInfoForm) form;
		String sql = "select company_name,address,tel,email,id from OC_COMPANY_INFO where del='OFF' ORDER BY id DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceCompanyInfoList interfaceforresultsettolist = new InterfaceCompanyInfoList();
		List<EntityBeanOc_Company_Info> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());
		request.setAttribute("pagebeanplus", pagebeanplus);
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}

	public ActionForward init_update_company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm loginform = (CompanyInfoForm) form;
		String id = loginform.getId();
		EntityBeanOc_Company_Info link = this.service_admin
				.Find_EntityBeanOc_Company_Info_By_ID(Integer.valueOf(id));
		request.setAttribute("PlaceView", link);
		return mapping.findForward("success");
	}

	public ActionForward admin_delete__company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm loginform = (CompanyInfoForm) form;
		String id = loginform.getId();
		id = this.cut_tail(id);
		this.service_admin.Delete_Oc_Company_Info(id);
		CompanyInfoForm newslistform = (CompanyInfoForm) form;
		String sql = "select company_name,address,tel,email,id from OC_COMPANY_INFO where del='OFF' ORDER BY id DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceCompanyInfoList interfaceforresultsettolist = new InterfaceCompanyInfoList();
		List<EntityBeanOc_Company_Info> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());
		request.setAttribute("pagebeanplus", pagebeanplus);
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}

	public ActionForward admin_init_oc_evaluate(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return mapping.findForward("success");
	}

	public ActionForward admin_update__company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm loginform = (CompanyInfoForm) form;
		String company_name = loginform.getCompany_name();
		String address = loginform.getAddress();
		String email = loginform.getEmail();
		String tel = loginform.getTel();
		String id = loginform.getId();
		EntityBeanOc_Company_Info company = new EntityBeanOc_Company_Info();
		company.setAddress(address);
		company.setCompany_name(company_name);
		company.setEmail(email);
		company.setTel(tel);
		company.setDel("OFF");
		company.setId(Integer.valueOf(id));
		this.service_admin.Update_Oc_Company_Info(company);
		CompanyInfoForm newslistform = (CompanyInfoForm) form;
		String sql = "select company_name,address,tel,email,id from OC_COMPANY_INFO where del='OFF' ORDER BY id DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceCompanyInfoList interfaceforresultsettolist = new InterfaceCompanyInfoList();
		List<EntityBeanOc_Company_Info> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());
		request.setAttribute("pagebeanplus", pagebeanplus);
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}
	public ActionForward admin_search_company_info(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		CompanyInfoForm newslistform = (CompanyInfoForm) form;
		String sql = "select company_name,address,tel,email,id from OC_COMPANY_INFO where del='OFF' ORDER BY id DESC";
		PageBeanPlus pagebeanplus = new PageBeanPlus("oracle", "sql", sql,
				Integer.valueOf(newslistform.getRowcountperpage()), Integer
						.valueOf(newslistform.getCurrentpage()),
				"loadrichtext()");
		InterfaceCompanyInfoList interfaceforresultsettolist = new InterfaceCompanyInfoList();
		List<EntityBeanOc_Company_Info> list = interfaceforresultsettolist
				.ViewOc_News(pagebeanplus.getFormatqueryresultset());
		request.setAttribute("pagebeanplus", pagebeanplus);
		request.setAttribute("list", list);
		request.setAttribute("newslistform", newslistform);
		return mapping.findForward("success");
	}
	private String cut_tail(String str) {
		String cut = str;
		if (str.endsWith(",")) {
			cut = cut.substring(0, cut.length() - 1);
		}
		return cut;
	}
}